package com.musemun.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * <p>
 *
 * </p>
 *
 * @author ZWYZY
 * @since 2020/5/27
 */
//@Configuration
public class WebAppConfig implements WebMvcConfigurer {
//    @Value("${my.upload.imgPath}")
//    private String path;
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        String staticMapping="/img/**";
        String localDirectory = "file:"+"static/img";
        registry.addResourceHandler(staticMapping).addResourceLocations(localDirectory);
        WebMvcConfigurer.super.addResourceHandlers(registry);
    }
}
